#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<assert.h>

char* my_strncat(char* dest, const char* src, size_t u)
{
	assert(dest && src);
	char* ret = dest;
	char* p = src;
	while (*dest)
	{
		dest++;
	}
	while (p < &src[u])
	{
		*dest++ = *p++;
	}
	return ret;
}

int main()
{
	char arr1[20] = "abcd";
	char arr2[10] = { 0 };
	gets(arr2);
	size_t k = 0;
	scanf("%u", &k);
	char* ret = my_strncat(arr1, arr2, k);
	printf("%s\n", ret);
	return 0;
}